<template>
    <el-container>
        <el-header>
            <el-row>
                <el-col :span="2">
                    <div @click="gb()">
                        <i v-if="iscollapse==false" calss="el-icon-s-fold"></i>
                        <i v-else calss="el-icon-s-unfold"></i>
                    </div>
                </el-col>
                <el-col :span="4">物信管理系统 </el-col>
            </el-row>
        </el-header>
        <el-container>
            <el-aside :width="iscollapse ? '64px' : '200px'">
                <el-menu
                    default-active="2"
                    background-color="#545c64"
                    text-color="#fff"
                    active-text-color="#ffd04b"
                    :unique-opened="true"
                    :router="true"
                    :collapse="iscollapse"
                    :collapse-transition=false
                >
                    <el-submenu :index="item.id + ''" v-for="item in list" :key="item.id">
                        <template slot="title">
                            <i :class="iconobj[item.id]"></i>
                            <span>{{ item.authName }}</span>
                        </template>
                        <el-menu-item
                            :index="item1.path"
                            v-for="item1 in item.children"
                            :key="item1.id"
                        >
                            <template slot="title">
                                <i class="dl-icon-menu"></i>
                                <span slot="title">{{ item1.authName }}</span>
                            </template>
                        </el-menu-item>
                    </el-submenu>
                </el-menu>
            </el-aside>
            <el-main>
                <router-view></router-view>
            </el-main>
        </el-container>
    </el-container>
</template>
<script>
export default {
    data() {
        return {
            list: [
                {
                    id:1,
                    authName: "系统管理",
                    path: null,
                    children: [
                        {
                            id:104,
                            authName:"用户列表",
                            path: "/user",
                            children: [],
                        },
                    ],
                },
                {
                    id:2,
                    authName: "商品管理",
                    path: null,
                    children: [
                        {
                            id: 204,
                            authName: "商品列表",
                            path: "/product",
                            children: [],
                        },
                    ],
                },
            ],
            iconobj: {
                1:"el-icon-s-tools",
                2:"el-icon-s-goods",
            },
            iscollapse:false,
        };
    },
    methods:{
        gb(){
            this.iscollapse=!this.iscollapse;
        }
    }
};
</script>
<style scoped>
.el-header{
    background-color: #b3c0d1;
    color: #333;
    text-align: center;
    line-height: 60px;
}

.el-aside{
    background-color: #d3dce6;
    color: #333;
    text-align: center;
    line-height: 200px;
}

.el-main{
    background-color: #e9eef3;
    color: #333;
    text-align: center;
    line-height: 160px;
}

.el-container {
    height: 550px;
}

.el-menu{
    border-right: 0px;
    height: 100%;
}
</style>

